package com.habdqn.easybuy.service.impl;

import com.habdqn.easybuy.dao.OrderDetailDao;
import com.habdqn.easybuy.dao.impl.OrderDetailDaoImpl;
import com.habdqn.easybuy.entity.OrderDetail;
import com.habdqn.easybuy.service.OrderDetailService;

import java.util.List;

/**
 * @author Xing.Jiejian
 * @date 2020/12/3
 */
public class OrderDetailServiceImpl implements OrderDetailService {
    private OrderDetailDao orderDetailDao = new OrderDetailDaoImpl();
    /**
     * 查询多条数据
     *
     * @param orderId 每页条数
     * @return 对象列表
     */
    @Override
    public List<OrderDetail> queryByOrder(int orderId) {
        return orderDetailDao.queryByOrder(orderId);
    }

    /**
     * 新增数据
     *
     * @param orderDetail 实例对象
     * @return 实例对象
     */
    @Override
    public void insert(OrderDetail orderDetail) {
        orderDetailDao.insert(orderDetail);
    }

    /**
     * 通过订单编号删除数据
     *
     * @param orderId 订单编号
     * @return 是否成功
     */
    @Override
    public boolean deleteByOrder(int orderId) {
        return orderDetailDao.deleteByOrder(orderId)>0;
    }
}
